﻿using Application.Dto;
using Application.IAppSrevices;
using AutoMapper;
using Domain.Entitys;
using Domain.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.AppSrevices
{
    public class SSService : ISSService
    {
        private readonly IMapper mapper;
        private readonly ISSRepository sSRepository;

        public SSService(IMapper mapper,ISSRepository sSRepository)
        {
            this.mapper = mapper;
            this.sSRepository = sSRepository;
        }

        /// <summary>
        /// 添加薪酬标准基本信息表
        /// </summary>
        /// <param name="sSAddDto"></param>
        /// <returns></returns>
        public async Task<int> SSAddAsync(SSAddDto sSAddDto)
        {
            SS sS = mapper.Map<SS>(sSAddDto);
            //sS.list = mapper.Map<List<SSD>>(sSAddDto.list);
            return await sSRepository.SSAddAsync(sS);
        }

        /// <summary>
        /// 修改变更信息
        /// </summary>
        /// <param name="sS"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<int> SSChangeUpdateAsync(SS sS)
        {
            return await sSRepository.SSChangeUpdateAsync(sS);
        }

        /// <summary>
        /// 查询全部薪酬标准信息
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<List<SS>> SSFill()
        {
            return await sSRepository.SSFill();
        }

        /// <summary>
        /// 根据编号查询薪酬标准基本信息表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<SS> SSSelectByIdAsync(string id)
        {
            return await sSRepository.SSSelectByIdAsync(id);
        }

        /// <summary>
        /// 根据薪酬主键查询数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<SS> SSSelectBySsdId(int id)
        {
            return await sSRepository.SSSelectBySsdId(id);
        }

        /// <summary>
        /// 查询等待复核数据
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public FenYe<SS> SSSelectFenYe(FenYe<SS> fenYe, string state)
        {
            return sSRepository.SSSelectFenYe(fenYe, state);
        }

        /// <summary>
        /// 多条件分页查询
        /// </summary>
        /// <param name="fenYe"></param>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public FenYe<SS> SSSelectWhere(FenYe<SS> fenYe, string id, string name, string startDate, string endDate, string state)
        {
            return sSRepository.SSSelectWhere(fenYe,id,name,startDate,endDate,state);
        }

        /// <summary>
        /// 通过复核
        /// </summary>
        /// <param name="sS"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<int> SSThroughReviewAsync(SSUpdateDto sSUpdateDto)
        {
            SS sS = mapper.Map<SS>(sSUpdateDto);
            return await sSRepository.SSThroughReviewAsync(sS);
        }
        public async Task<List<SS>> GetSS()
        {
            return await sSRepository.GetSS();
        }
    }
}
